package loadvideo;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.widget.ImageView;

import java.io.IOException;


/**
 * Created by Administrator on 2016/9/11.
 */
public class ImageTask extends AsyncTask<String, Video,Bitmap> {
    private ImageView mImageView;
    public ImageTask(ImageView imageView ){
        this.mImageView=imageView;
    }
    @Override
    protected Bitmap doInBackground(String... params) {
        try {
            byte[] bytes = HttpUtilVideo.getJsonByPath(params[0]);
            return BitmapFactory.decodeByteArray(bytes,0,bytes.length);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    protected void onPostExecute(Bitmap bitmap) {
        super.onPostExecute(bitmap);
        mImageView.setImageBitmap(bitmap);
    }
}
